<%
var title="修改密码";
layout("/layouts/blank.html",{title:title}){
%>
<style type="text/css">
    #container {
        background-image: url("${base!}/static/plugins/adminlte/img/boxed-bg.jpg");
        height: 100%;
        overflow: hidden;
    }

    .from-box {
        padding-top: 10%;
        margin: 0 auto;
        width: 50%;
    }

    .form-group {
        height: 35px;
        margin-top: 15px;
    }

    .box-header {
        text-align: center;
    }


</style>
<section class="content" id="container" v-cloak>
    <div class="from-box">
        <form role="form" method="post" name="form1" id="form1">
            <div class="box box-info">
                <div class="box-header with-border">
                    <h3 class="box-title">请先修改密码后再登陆系统</h3>
                </div>
                <form class="form-horizontal">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">旧密码：</label>
                        <div class="col-sm-10">
                            <input type="password" v-model="fromData.oldPass" class="form-control"
                                   placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">新密码：</label>
                        <div class="col-sm-10">
                            <input type="password" v-model="fromData.newPass" class="form-control"
                                   placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">重复新密码：</label>
                        <div class="col-sm-10">
                            <input type="password" class="form-control" v-model="fromData.repeatNewPass"
                                   placeholder="">
                        </div>
                    </div>
                    <div class="box-footer" style="text-align: center">
                        <button type="button" @click="handleSubmit" :disabled="fromDataSubmit"
                                class="btn btn-info ">修改</button>
                    </div>
                </form>
            </div>
        </form>
    </div>
</section>
<script type="text/javascript">
    var vm = new Vue({
        el: '#container',
        data: {
            fromData: {
                oldPass: "",
                newPass: "",
                repeatNewPass: "",
            },
            fromDataSubmit: false,

        },
        methods: {
            handleSubmit: function () {
                this.fromDataSubmit = true;
                var fromData = core.convertDataJSON(this.fromData)
                fromData.oldPass = this.fromData.oldPass;
                fromData.newPass = this.fromData.newPass;
                fromData.repeatNewPass = this.fromData.repeatNewPass;
                fromData.avatar = this.fromData.avatar;
                var jsonre = core.postJSON("/manage/user/fristLogin/ChangePass", fromData);
                console.log(jsonre.data)
                if (jsonre.data) {
                    core.msg("密码修改成功！请使用新密码登录！");
                    setTimeout(function () {
                        window.location.href = "${base!}/"
                    }, 1500)
                } else {
                    core.msg(jsonre);
                }
                this.fromDataSubmit = false;
            }
        },
        created: function () {

        }
    });
</script>
<%}%>